#include "StdAfx.h"
#include "BCMessageBox.h"
#include "SBCGlobal.h"
#include "LanManager.h"




UINT    SMInfoMessageBox( LPCTSTR szMsg,DWORD dwWaitTime , BOOL bCenterScreen)
{
	CMessageBox dlg( szMsg,MB_OK|MB_ICONINFORMATION,dwWaitTime );
	if (bCenterScreen)
	{
		dlg.CenterScreen();
	}
	return dlg.DoModal();
}

UINT    SMInfoMessageBox( UINT IDPrompt,DWORD dwWaitTime , BOOL bCenterScreen /*= FALSE*/)
{
	CString szMsg;
	g_lanManager.ReadTableString( IDPrompt,szMsg );

	return SMInfoMessageBox( szMsg,dwWaitTime, bCenterScreen );
}

UINT    SMQuestionMessageBox( LPCTSTR szMsg,DWORD dwWaitTime )
{
	CMessageBox dlg( szMsg,MB_OKCANCEL|MB_ICONQUESTION,dwWaitTime );
	return dlg.DoModal();
}

UINT    SMQuestionMessageBox( UINT IDPrompt,DWORD dwWaitTime )
{
	CString szMsg;
	g_lanManager.ReadTableString( IDPrompt,szMsg );

	return SMQuestionMessageBox( szMsg,dwWaitTime );
}

//CDlgNotify g_dlgNotify;

void    SMNotifyBox( LPCTSTR szMsg )
{
#if defined MEETINGROOM_VERSION
	CDlgSysInfoTip *pDlg = new CDlgSysInfoTip(szMsg);
	pDlg->Create();
	if (pDlg->GetSafeHwnd() == NULL)
		delete pDlg;
#endif
}

void    SMNotifyBox( UINT IDPrompt )
{
	CString szMsg;
	g_lanManager.ReadTableString(IDPrompt, szMsg);
	SMNotifyBox( szMsg );
}

BOOL GetVersionIsHigherThanXp()
{
	
	OSVERSIONINFOEX osvi;
	BOOL bOsVersionInfoEx;

	// Try calling GetVersionEx using the OSVERSIONINFOEX structure.
	//
	// If that fails, try using the OSVERSIONINFO structure.

	ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
	osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);

	if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) )
	{
		// If OSVERSIONINFOEX doesn't work, try OSVERSIONINFO.
		osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
		if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) ) 
			return FALSE;
	}
	if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion >= 6) 
	{
		return TRUE;
	}
	return FALSE;
}